﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:geo="clr-namespace:DeepEarth.Toolkit.Geometry">

    <Style TargetType="geo:Balloon">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="geo:Balloon">
                    <Grid HorizontalAlignment="Center" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5">
                        <Grid.RenderTransform>
                            <TransformGroup>
                                <ScaleTransform x:Name="PART_ScaleTransform" ScaleX="1" ScaleY="1" />
                                <TranslateTransform x:Name="PART_TranslateTransform" X="0" Y="0" />
                            </TransformGroup>
                        </Grid.RenderTransform>
                        <Grid x:Name="LayoutRoot" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
                            <Grid.RenderTransform>
                                <TransformGroup>
                                    <TranslateTransform X="{Binding TranslateX, RelativeSource={RelativeSource Templatedparent}}" Y="{Binding TranslateY, RelativeSource={RelativeSource Templatedparent}}"></TranslateTransform>
                                </TransformGroup>
                            </Grid.RenderTransform>
                            <Border CornerRadius="8,8,8,8" BorderBrush="Black" BorderThickness="2" Background="{TemplateBinding Background}" >
                                <Grid>
                                    <Grid.Resources>
                                        <Style TargetType="Button" x:Key="closeButtonStyle">
                                            <Setter Property="Template">
                                                <Setter.Value>
                                                    <ControlTemplate TargetType="Button">
                                                        <Grid>
                                                            <TextBlock Text="X" FontSize="12"></TextBlock>
                                                        </Grid>
                                                    </ControlTemplate>
                                                </Setter.Value>
                                            </Setter>
                                        </Style>
                                    </Grid.Resources>

                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"></RowDefinition>
                                        <RowDefinition></RowDefinition>
                                    </Grid.RowDefinitions>
                                    <!--<Button Grid.Row="0" Command="{TemplateBinding CloseCommand}" Style="{StaticResource closeButtonStyle}" HorizontalAlignment="Right"></Button>-->
                                    <ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
                                        <TextBlock Text="{TemplateBinding Text}" Foreground="{TemplateBinding Foreground}" />
                                    </ScrollViewer>
                                </Grid>
                            </Border>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
